{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "779f7c9d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.2.5\n",
      "1.21.0\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "print(pd.__version__)\n",
    "print(np.__version__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "741fa2ab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<PandasArray>\n",
       "[1, 2, 3, 4]\n",
       "Length: 4, dtype: int64"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s = pd.Series([1, 2, 3, 4], index=[\"a\", \"b\", \"c\", \"d\"], name=\"x\")\n",
    "\n",
    "# 返回PandasArray\n",
    "s.array"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "b07ee6ca",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dtype('int64')"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 返回数据类型\n",
    "s.dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "567a73bb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dtype('int64')"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 返回数据类型\n",
    "s.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "47d7971d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 是否为空\n",
    "s.empty"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "3d33ec8b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 是否有缺省值\n",
    "s.hasnans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "e0d181f7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['a', 'b', 'c', 'd'], dtype='object')"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 返回索引列\n",
    "s.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "3b4d57c5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 是否单调\n",
    "s.is_monotonic"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "d26342fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 是否值唯一\n",
    "s.is_unique"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "9b36f14e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'x'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 序列变量名\n",
    "s.name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "a88eeda3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "32"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 序列占字节数\n",
    "s.nbytes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "4ea03b78",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4,)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 序列形状\n",
    "s.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "ca162f4e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 总共元素个数\n",
    "s.size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "9bd0899b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 2, 3, 4], dtype=int64)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 返回numpy.ndarray类型\n",
    "s.values"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
